﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Windows.Media.Media3D;

namespace Kinect.KinectMouseControl
{
    public static class Utilities
    {
        public static float ScaleNumber(float input, float inputLower, float inputHigher, float outputLower, float outputHigher)
        {
            if (input < inputLower)
            {
                return outputLower;
            }

            if (input > inputHigher)
            {
                return outputHigher;
            }

            var inputRange = inputHigher - inputLower;
            var outputRange = outputHigher - outputLower;

            var inputPercentOfRange = (inputHigher - input) / inputRange;

            var output = outputHigher - (inputPercentOfRange * outputRange);

            return output;
        }

        public static Point3D ToPoint3D(this Microsoft.Research.Kinect.Nui.Vector position)
        {
            return new Point3D(position.X, position.Y, position.Z);
        }
    }
}
